# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# Name:         login
# Description:  
# Author:       Administrator
# Date:         2020/2/10
#-------------------------------------------------------------------------------
from guitest.woniusales_test01.util.utility import Utility


class Login:

	# 向用户名输入框输入内容
	def input_uname(self,driver,username):
		uname = driver.find_element_by_id('username')
		Utility.send_input(uname,username)

	# 向密码框输入密码
	def input_upass(self,driver,password):
		upass = driver.find_element_by_id('password')
		Utility.send_input(upass,password)

	# 向验证码框输入验证码
	def input_vfcode(self,driver,verifycode):
		vfcode = driver.find_element_by_id('verifycode')
		Utility.send_input(vfcode,verifycode)

	# 点击登录按钮
	def click_button(self,driver):
		driver.find_element_by_css_selector('button.form-control').click()

	# 将以上的动作进行组织，形成整体的登录操作
	def do_login(self,driver,username,password,verifycode):
		self.input_uname(driver,username)
		self.input_upass(driver,password)
		self.input_vfcode(driver,verifycode)
		self.click_button(driver)
